import { Upload, } from 'antd'
  export default(props)=>{

    const uploadImg = (e)=> {
        console.log('图片上传成功',e)
        if(e.file.response){
            props.onChange(e.file.response.data.img)
        }
      }
    return(
        <Upload
        name="xxx"
        action="http://localhost:9090/api/v2/upload/img"
        listType="picture-card"
        className="avatar-uploader"
        showUploadList={false}
        onChange={uploadImg}
      >
        {
          props.value
          ? <div className="uploadimg"><img src={'http://localhost:8888'+props.value} alt=""/></div>
          : <div>上传</div>
  
        }
      </Upload>
    
    )
    

}